# Maintainer: Angel Velasquez <angvp@archlinux.org> 
# Contributor: Stéphane Gaudreault <stephane@archlinux.org>

pkgname=serf
pkgver=1.3.9
pkgrel=8
pkgdesc="High-performance asynchronous HTTP client library"
arch=('x86_64')
url="https://serf.apache.org"
license=('Apache')
depends=('apr-util')
makedepends=('scons')
source=(https://www.apache.org/dist/serf/${pkgname}-${pkgver}.tar.bz2{,.asc}
        scons-python3.patch
        openssl3-ERR_GET_FUNC.patch
        openssl3-BIO_ctrl.patch)
validpgpkeys=('C236283C970D2C3CFEEB4936BF35CF0078383142')
sha256sums=('549c2d21c577a8a9c0450facb5cca809f26591f048e466552240947bdf7a87cc'
            'SKIP'
            '363732546098b4c9415eb5d38b595d04c660c6324a34159768d334507b7d241f'
            '15026f5ce219d2222dbdb6dcbb8911f3c8fbe0cedf3a2ec2ff434dde8d7fb9be'
            'bf30b79aff5b058ba3852930dad4e5c16fc2e2d76810ca80e6e22e3c8121cff6')

prepare() {
  cd $pkgname-$pkgver
  patch -p1 -i ../scons-python3.patch
  patch -p1 -i ../openssl3-ERR_GET_FUNC.patch
  patch -p1 -i ../openssl3-BIO_ctrl.patch
}

build() {
  cd ${pkgname}-${pkgver}
  scons CFLAGS="${CFLAGS}" \
        LINKFLAGS="${LDFLAGS}" \
        PREFIX=/usr GSSAPI=/usr/bin/krb5-config
}

check() {
  cd ${pkgname}-${pkgver}
  # Runs into infinite loop
  #scons check
}

package() {
  cd ${pkgname}-${pkgver}
  install -d "${pkgdir}/usr"
  scons install --install-sandbox="${pkgdir}"
}
